Remove looping from handling of xm domid. This command should now work first
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Sun, 27 Nov 2005 01:01:42 +0000 (01:01 +0000)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Sun, 27 Nov 2005 01:01:42 +0000 (01:01 +0000)
time after creation of a domain.  Have the getRunningDomains method detect
failure of the xm list command, as indicated by the error code.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/xm-test/lib/XmTestLib/Xm.py

index 7ff0ac883e053d002e4c31230bc0f94a12159725..43ee90dd7c15bd41e0b59ee8443cc232d1cc74d6 100644 (file)
@@ -47,20 +47,13 @@ class XmError(Exception):
 def domid(name):
     status, output = traceCommand("xm domid " + name);
 
-    if re.search("Traceback", output):
-        print "*** xm domid failed with:"
-        print output
-        for i in range(0,10):
-            status, output = traceCommand("xm list")
-            status, output = traceCommand("xm domid " + name);
-            if not re.search("Traceback", output):
-                break
-        
+    if status != 0 or "Traceback" in output:
+        return -1
     try:
-        id = int(output);
+        return int(output)
     except:
-        id = -1;
-    return id;
+        raise XmError("xm domid failed", trace=output, status=status)
+
 
 def domname(id):
     status, output = traceCommand("xm domname " + str(id));
@@ -75,7 +68,7 @@ def isDomainRunning(domain):
 
 def getRunningDomains():
     status, output = traceCommand("xm list");
-    if "Traceback" in output:
+    if status != 0 or "Traceback" in output:
         raise XmError("xm failed", trace=output, status=status)
     
     lines = output.splitlines();